<?php
/*
 * @project CreativeFramework
 * @version <#RELEASE_VERSION#>
 * @license GNU Lesser General Public License
 * @author Jimmie Lin
 */

// PHP Version
$version = intval(str_replace(".", "", phpversion()));
if($version < 525) {
	die("Creative Framework Generation 4 Cannot run with PHP 5.2.5 or older, please upgrade your PHP Install");
}

/*
 * If we are using PHP 5.3 or above, then these features are already deprecated,
 * no need to run resource incentive checks.
 * @since 9 Jan 2010
 */
if(version_compare(PHP_VERSION, '6.0.0') >= 0 || version_compare(PHP_VERSION, '5.3.0') >= 0) {

}
else {
	// Magic Quotes, the thing that we all hate
	$evilquotes = get_magic_quotes_gpc();
	if($evilquotes == 1) {
		if(function_exists('set_magic_quotes_runtime')){
				set_magic_quotes_runtime(0);
		}
		if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()){
				foreach($_GET as $key => $value){
						$_GET[$key] = stripslashes($value);
				}
				foreach($_POST as $key => $value){
						$_POST[$key] = stripslashes($value);
				}
				foreach($_COOKIE as $key => $value){
						$_COOKIE[$key] = stripslashes($value);
				}
		}
	}
	
	// Wtf, register_globals for what?
	$evilglobals = ini_get('register_globals');
	if($evilglobals) {
		// This is resource incentive - although I really want to FORCE people and
		// tell them to GTFO, I should fix this.
		// It is deprecated in PHP 5.3 and removed in 6, so no worries anyway.
		$G = array_merge($_GET, $_POST, $_COOKIE, $_SESSION, $_ENV, $_SERVER);
		foreach($G as $k => $v) {
			if(isset($$k) and $$k == $v) {
				unset($$k);
			}
		}
		unset($G, $k, $v);
	}
}

// cURL
if(!function_exists("curl_init")) {
	// Assume file_get_contents would work.
	
}

// All done, lets go back
